INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

IF(WIN32)
	INCLUDE_DIRECTORIES(${3RDPARTY_DIR}/include/gdal)
	LINK_DIRECTORIES(${3RDPARTY_DIR}/lib/grpc)
ENDIF(WIN32)

SET(LIB_NAME OCGISApp)

IF(WIN32)
	SET(TARGET_H
		ApplicationInit.h
		Util.h
	)
	SET(TARGET_SRC
		main.cpp
	)
	SET(TARGET_COMMON_LIBRARIES 
		OCMain
		OCServer
		OCGIS
		OCNetCDF
		OCGrib
		libprotobuf
		jsoncpp
	)
	SET(TARGET_EXTERNAL_LIBRARIES 
		gdal
		ws2_32
	)
ELSE(WIN32)
	SET(TARGET_H
		Util.h
	)
	SET(TARGET_SRC
		main.cpp
	)
	SET(TARGET_COMMON_LIBRARIES 
		OCMain
		OCGIS
		OCGrib
	)
	SET(TARGET_EXTERNAL_LIBRARIES 
		gdal
		pthread
		jsoncpp
	)
ENDIF(WIN32)

SETUP_GROUP()

SETUP_APPLICATION(${LIB_NAME})
ADD_DEPENDENCIES(${LIB_NAME} OCGIS)
ADD_DEPENDENCIES(${LIB_NAME} OCNetCDF)

#ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS)

if (MSVC)
	SETUP_DEP_PLUGIN(FreeImageCodec)
	SETUP_DEP_PLUGIN(MyTest)
	#SETUP_DEP_PLUGIN(Project_IceCoverPre)
	#SETUP_DEP_PLUGIN(Project_MountainTorrents)
	SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${OUTPUT_BINDIR})
	#SET_PROPERTY(TARGET ${LIB_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
endif()

